<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>清除浮动方式3</title>
  <style type="text/css">
    .clearfix::after{
      content: "";
      display: block;
      clear: both;
    }

    .box {
      width: 200px;
      border: 10px solid #000;
    }

    .box .inner-box{
      float: left;
      width: 100px;
      height: 100px;
    }

    .box .inner-box.box1{
      background-color: green;
    }

    .box .inner-box.box2{
      background-color: orange;
    }
  </style>
</head>
<body>
  <div class="box clearfix">
    <div class="inner-box box1"></div>
    <div class="inner-box box2"></div>
  </div>
</body>
</html>